package com.corona.game;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.math.Vector2;
import com.corona.Game;
import com.corona.game.util.TextureCache;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/* compiled from: Menu.java */
/* loaded from: pokewilds.jar:com/pkmngen/game/DrawYesNoMenu.class */
public class DrawYesNoMenu extends Menu {
    Action nextAction2;
    Sprite arrow;
    Sprite textBox;
    public Action.Layer layer;
    Map<Integer, Vector2> getCoords;
    int curr;
    Vector2 newPos;
    Sprite helperSprite;
    int cursorDelay;
    String itemName;
    Menu prevMenu;
    ArrayList<String> words;

    public DrawYesNoMenu(Menu prevMenu, Action yesAction, Action noAction) {
        this(prevMenu, 0, yesAction, noAction);
    }

    public DrawYesNoMenu(Menu prevMenu, int startIndex, Action yesAction, Action noAction) {
        this.layer = Action.Layer.gui_104;
        this.getCoords = new HashMap();
        this.words = new ArrayList<>();
        this.prevMenu = prevMenu;
        this.nextAction = yesAction;
        this.nextAction2 = noAction;
        this.cursorDelay = 0;
        this.arrow = new Sprite(TextureCache.get(Gdx.files.internal("battle/arrow_right1.png")), 0, 0, 5, 7);
        this.textBox = new Sprite(TextureCache.get(Gdx.files.internal("menu/yesno_bg1.png")), 0, 0, 160, 144);
        this.getCoords.put(0, new Vector2(121.0f, 72.0f));
        this.getCoords.put(1, new Vector2(121.0f, 56.0f));
        this.curr = startIndex;
        this.newPos = this.getCoords.get(Integer.valueOf(this.curr));
        this.arrow.setPosition(this.newPos.x, this.newPos.y);
        this.words.add("YES");
        this.words.add("NO");
    }

    @Override // com.corona.game.Action
    public String getCamera() {
        return "gui";
    }

    @Override // com.corona.game.Action
    public Action.Layer getLayer() {
        return this.layer;
    }

    @Override // com.corona.game.Action
    public void step(Game game) {
        if (this.prevMenu != null) {
            this.prevMenu.step(game);
        }
        game.uiBatch.draw(this.textBox, this.textBox.getX(), this.textBox.getY());
        for (int i = 0; i < this.words.size(); i++) {
            String word = this.words.get(i);
            for (int j = 0; j < word.length(); j++) {
                game.uiBatch.draw(game.textDict.get(Character.valueOf(word.charAt(j))), (float) (128 + (8 * j)), (float) (71 - (16 * i)));
            }
        }
        if (!this.disabled) {
            if (InputProcessor.upJustPressed) {
                if (this.curr > 0) {
                    this.curr--;
                    this.newPos = this.getCoords.get(Integer.valueOf(this.curr));
                }
            } else if (InputProcessor.downJustPressed && this.curr < 1) {
                this.curr++;
                this.newPos = this.getCoords.get(Integer.valueOf(this.curr));
            }
            if (this.cursorDelay >= 2) {
                this.arrow.setPosition(this.newPos.x, this.newPos.y);
                game.uiBatch.draw(this.arrow, this.arrow.getX(), this.arrow.getY());
            } else {
                this.cursorDelay++;
            }
            if (InputProcessor.aJustPressed) {
                game.actionStack.remove(this);
                if (this.curr == 0) {
                    game.insertAction(this.nextAction);
                } else {
                    game.insertAction(this.nextAction2);
                }
            } else if (InputProcessor.bJustPressed) {
                game.actionStack.remove(this);
                if (this.prevMenu != null) {
                    this.prevMenu.disabled = false;
                    game.insertAction(this.prevMenu);
                    return;
                }
                game.insertAction(this.nextAction2);
            }
        }
    }
}
